制作方法
《自定义右键菜单(链接网址)》的制作方法
【实例说明】:
本例制作一个在swf作品中右击弹出自定义菜单,菜单中的命令全部为网址链接的效果。
【操作步骤】:
一、制作背景层
- 新建一个文档,大小可按默认设置。双击“图层1”编辑其名称为“背景层”;
- 从外面随意导入一张图片到舞台上面,放在“背景层”层的第一帧,如下图:
二、添加代码
- 单击添加添加图层按钮,再新建一个图层;
- 双击新图层编辑其名称为“代码层”;
- 选中第1帧,添加如下代码:
function dj_menu0() {
getURL("http://www.luotao2008.cn", "_blank");
}
// End of the function
function dj_menu1() {
getURL("http://www.luotao2008.cn/flash-JC-0.html", "_blank");
}
// End of the function
function dj_menu2() {
getURL("https://www.luotao2008.cn/XP-0.html", "_blank");
}
// End of the function
function dj_menu3() {
getURL("http://www.luotao2008.cn/DZ-KJ-0.html", "_blank");
}
// End of the function
右键菜单 = new ContextMenu();
//删除原始菜单状态!
eval("右键菜单").hideBuiltInItems();
//自定义菜单项目!
eval("右键菜单").customItems.push(new ContextMenuItem("【闪客天空教程网www.luotao2008.cn】", dj_menu0, false));
eval("右键菜单").customItems.push(new ContextMenuItem("【动画制作教程】", dj_menu1, false));
eval("右键菜单").customItems.push(new ContextMenuItem("【系统操作教程】", dj_menu2, false));
eval("右键菜单").customItems.push(new ContextMenuItem("【动画制作】", dj_menu3, false));
_root.menu = eval("右键菜单");
四、最后按“Ctrl+Enter”组合键测试影片,在影片上面右击查看效果。
|